<template>
	<view>
		<view class="type-of-service-list" v-if="isStyle">
			<view class="item-service" v-for="(item,index) in list" :key="index" @click="toDetail(item)">
				<image class="left-img" :src="item.images[0]" mode="aspectFill"></image>
				<view class="right-info">
					<view class="" style="display: flex;align-items: center;">
						<view class="service-title">{{item.title}}</view>
						<view class="today-time">
							<view class="titles">最快上门</view>
							<view class="time">30分钟</view>
						</view>
					</view>
					
				<!-- 	<view class="shop-lines" style="display: flex;align-items: baseline;">
						<uni-icons custom-prefix="iconfont" type="icon-dianpu1" color="#888889" size="14"></uni-icons>
						<view>{{item.store_name}}</view>
					</view> -->
					<!-- <view class="service-desc"><rich-text :nodes="item.content"></rich-text></view> -->
					<view class="price-num">
						<view class="price">
							<text>{{item.price}}</text>
							<text class="danwei">元/次</text>
						</view>
						<view class="nums">
							<text>已售{{item.buy_num}}</text>
							<text class="lines"></text>
							<text>好评{{item.high_opinion}}条</text>
						</view>
					</view>
					<view class="technician-search-recommend-list">
						<view class="item-technician" @click.stop="toTen(items)" v-for="(items,indexs) in item.technician" :key="indexs">
							<image :src="items.work_clothes_image" mode="aspectFill"></image>
							<view class="bottom-text">{{item.technician_nickname || items.real_name}}</view>
						</view>
						<view class="more" @click.stop="toMore(item)">
							<view>更多</view>
							<image class="more-icon" src="../../static/search/more.png" mode=""></image>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="goods--box" v-else>
			<view class="goods--item"  v-for="(item, index) in list" :key="index" @click="toDetail(item)">
				<view class="item--cover" :style="{backgroundImage: 'url(' + item.images[0] + ')'}"></view>
				<view :class="path == 'index'?'item--content borderStyle':'item--content' "> 
					<view class="title">{{item.title}}</view>
					<view class="slod-num">已售{{item.buy_num}}
						<view class="lines"></view>好评{{item.high_opinion}} 条
					</view>
					<view class="price">{{item.price}}
						<view>元/次</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		name:"horizontalMassage",
		props:{
			list: {
				type: Array,
				default : () => {
					return []
				}
			},
			isStyle:{
				type: Boolean,
				default : false
			},
			ismore:{
				type: Boolean,
				default : false
			},
			path:{
				type: String,
				default : ''
			}
		},
		data(){
			return{
				borderStyle:{
					border:'1rpx solid #E8E8E8',
					borderRadius:'0rpx 0rpx 20rpx 20rpx',
					overflow:'hidden'
				}
			}
		},
		mounted() {
			
		},
		methods:{
			toDetail(item){
				uni.navigateTo({
					url:'/otherpages/massage/massageDetail?id='+item.id
				})
			},
			toTen(item){
				uni.navigateTo({
					url:'/otherpages/technician/technician?id='+item.id
				})
			},
			toMore(){
				uni.navigateTo({
					url:'/otherpages/technician/technicianList'
				})
			}
		}
	}
</script>

<style lang="scss">
	.item-service{
		background-color: #fff;
		border-radius: 10rpx;
		padding: 30rpx;
		display: flex;
		align-items: flex-start;
		margin-bottom: 20rpx;
		// height: 374rpx;
		.left-img{
			width: 160rpx;
			height: 214rpx;
			flex: 0 0 auto;
		}
		.right-info{
			margin-left: 31rpx;
			flex-grow: 1;
			.service-title{
				font-size: 30rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 500;
				color: #0F0807;
				line-height: 42rpx;
				width: 50%;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				line-clamp: 2;
				-webkit-box-orient: vertical;
			}
			.today-time{
				width: 186rpx;
				height: 32rpx;
				margin-left: 26rpx;
				background: url('https://qiniu-cdn.maeiyun.com/imgs/massage/bg.png')no-repeat;
				background-size: 100% 100%;
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 0 12rpx;
				margin-left: auto;
				.titles{
					font-size: 20rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					color: #FFFFFF;
				}
				.time{
					font-size: 20rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					color: #EF5233;
				}
			}
			.shop-lines{
				font-size: 22rpx;
				font-weight: 400;
				color: #888889;
				margin-top: 10rpx;
				view{
					margin-left: 8rpx;
				}
			}
			.service-desc{
				font-size: 22rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				color: #888889;
				line-height: 30rpx;
				margin-top: 21rpx;
			}
			.price-num{
				display: flex;
				align-items: center;
				justify-content: space-between;
				.price{
					font-size: 34rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 500;
					color: #EF5233;
					line-height: 48rpx;
					.danwei{
						font-size: 18rpx;
						font-family: PingFangSC, PingFang SC;
						font-weight: 400;
						color: #EC2700;
						line-height: 25rpx;
					}
				}
				.nums{
					font-size: 20rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					color: #858587;
					line-height: 28rpx;
					display: flex;
					align-items: center;
					.lines{
						display: inline-block;
						width: 2rpx;
						height: 20rpx;
						background-color: #DBDBDB;
						margin: 0 8rpx;
					}
				}
			}
			.technician-search-recommend-list{
				margin-top: 17rpx;
				display: flex;
				align-items: center;
				.more{
					font-size: 20rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					color: #858587;
					line-height: 28rpx;
					text-align: center;
					margin-left: 20rpx;
					image{
						width: 21rpx;
						height: 20rpx;
						margin-top:18rpx;
					}
				}
				.item-technician{
					width: 130rpx;
					height: 180rpx;
					border-radius: 10rpx;
					overflow: hidden;
					position: relative;
					margin-right: 14rpx;
					image{
						width: 130rpx;
						height: 180rpx;
					}
					.bottom-text{
						position: absolute;
						bottom: 0;
						right: 0;
						left: 0;
						font-size: 20rpx;
						background: rgba(0, 0, 0, .6);
						color: #fff;
						text-align: center;
					}
				}
				
			}
		}
	}
	
	// 竖排样式
	$padding: 30rpx;
	$margin: 10rpx;
	$radius: 20rpx;
	
	.ellipsis-1 {
		max-width: 100%;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
	
	.ellipsis-2 {
		max-width: 100%;
		display: -webkit-box;
		overflow: hidden;
		text-overflow: ellipsis;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
	}
	
	.goods--box {
		display: flex;
		flex-wrap: wrap;
		padding: $padding/3;
		padding-top: 0;
		.goods--item {
			background: white;
			width: calc(50% - #{$margin*2});
			background: white;
			border-radius: $radius;
			overflow: hidden;
			margin: $margin;
	
			.item--cover {
				width: 100%;
				padding-top: 100%;
				background-position: center;
				background-size: cover;
			}
	
			.item--content {
				padding: 20rpx;
				
				&>.title {
					font-size: 28rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					color: #363737;
					line-height: 40rpx;
					margin-bottom: 10rpx;
				}
				.shop-lines{
					font-size: 22rpx;
					font-weight: 400;
					color: #888889;
					view{
						margin-left: 8rpx;
					}
				}
				&>.slod-num {
					font-size: 20rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					color: #DE8C3E;
					line-height: 28rpx;
					margin-bottom: 10rpx;
					display: flex;
					align-items: center;
	
					.lines {
						width: 1rpx;
						height: 20rpx;
						background-color:  #DBDBDB;
						margin: 0 10rpx;
					}
				}
	
				&>.price {
					display: flex;
					align-items: center;
					line-height: 40rpx;
					font-weight: bold;
					color: #d4282d;
					font-size: 28rpx;
					line-height: 42rpx;
	
					view {
						font-size: 18rpx;
						font-family: PingFangSC, PingFang SC;
						font-weight: 400;
						color: #EC2700;
						line-height: 25rpx
					}
				}
			}
			.borderStyle{
				border:1rpx solid #E8E8E8;
				border-radius:0rpx 0rpx 20rpx 20rpx;
				overflow:hidden;
			}
		}
	}
	
	
	
	
</style>